using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class State
{
    protected string AnimName;
    protected Player Player;
    protected StateMachine StateMachine;
    protected float xInput;
    protected Rigidbody2D rb;

    public State(Player _player, string _Animname,StateMachine _stateMachine)
    {
        this.Player = _player;
        this.StateMachine = _stateMachine;
        this.AnimName = _Animname; 
        rb = Player.rb;
    }


    public virtual void Enter()
    {
        Player.animator.SetBool(AnimName, true);
    }

    public virtual void Update()
    {
        xInput = Input.GetAxis("Horizontal");

        Player.animator.SetFloat("yVelocity", rb.velocity.y);
        Player.animator.SetFloat("xVelocity", Mathf.Abs(xInput));
    }

    public virtual void Exit()
    {
        Player.animator.SetBool(AnimName, false);
    }

}
